#include<iostream>
#include<vector>
#include<queue>

using namespace std;

int main(){
	int n;
	cin>>n;
	vector<vector<int>> edges(n-1, vector<int>(2));
	for(int i=0;i<n-1;i++){
		cin>>edges[i][0]>>edges[i][1];
	}
	
	vector<int> degree(n);
    vector<vector<int>> adj(n);
    for (auto & edge : edges){
        adj[edge[0]].emplace_back(edge[1]);
        adj[edge[1]].emplace_back(edge[0]);
        degree[edge[0]]++;
        degree[edge[1]]++;
    }
    queue<int> qu;
    vector<int> ans;
    for (int i = 0; i < n; i++) {
        if (degree[i] == 1) {
            qu.emplace(i);
        }
    }
    int remainNodes = n;
    while (remainNodes > 2) {
        int sz = qu.size();
        remainNodes -= sz;
        for (int i = 0; i < sz; i++) {
            int curr = qu.front();
            qu.pop();
            for (auto & v : adj[curr]) {
                if (--degree[v] == 1) {
                    qu.emplace(v);
                }
            }
        }
    }
    
    while (!qu.empty()) {
        ans.emplace_back(qu.front());
        qu.pop();
    }
    
    for(int i=0;i<ans.size();i++){
    	cout<<ans[i]<<" ";
	}

    return 0;
} 
